#include<iostream>
//#include<string>
#include<cstdio>
#include<cstring>
//#include<cmath>
//#include<algorithm>
using namespace std;

char s[1005];
int js[30]={0};

int main()
{
	cin.getline(s,1005);
	int len=strlen(s);
	int max=-1;
	char max_ch;
	for (int i=0;i<=len-1;i++)
		js[s[i]-'a']++;
	for (int i=0;i<=25;i++)
	{
		if (max<js[i])
		{
			max=js[i];
			max_ch=i+'a';
		}
	}
	cout<<max_ch<<' '<<max<<endl;
    
    return 0;
}